package com.diaohw.platform.remote.auth.enums;

public enum AccountStateEnum {
    NORMAL("正常", 1),
    LOCK("锁定", 2),
    DISABLE("禁用", 0),
    UNKNOWN("未知", -1);

    /**
     * 状态名称
     */
    public final String name;
    /**
     * 状态码
     */
    public final int code;

    AccountStateEnum(String name, int code) {
        this.name = name;
        this.code = code;
    }

    public static AccountStateEnum parse(int code) {

        for (AccountStateEnum e : AccountStateEnum.values()) {
            if (e.code == code) {
                return e;
            }
        }
        return UNKNOWN;
    }

}
